{subtemplate template/common/com_header.html}
<script type="text/javascript" src='./template/js/jquery1.8.js' ></script>
<script type="text/javascript" src='./template/js/lhgcalendar.min.js' ></script>
<style type="text/css">
table td{
    border:1px solid #ccc;
}
</style>

<script type='text/javascript'>
function upload(){
    $.ajaxFileUpload({
          url:'?m=special&a=doUpload',
          fileElementId:'spfile',
          dataType:'json',
          success:function(feed){
              $('table tr:nth-child(2)').children().html('<img width="100" height="100" src="'+feed.img+'" />');
              $(':input[name=img]').attr('value',feed.img); 
          }
        });return false;
}




$(function(){
	$(':input[name="cate"]').change(function(){
		var cateId=$(this).attr('value');
		var html='';
		var pObj=$('#subcate');
	    $.ajax({
	        url:'?m=special&a=getCate&id='+cateId,
	        type:'GET',
	        success:function(feed){
	            eval('mydata='+feed);
	            for(var i=0;i<mydata.data.length;i++){
		            html+='<option value="'+mydata.data[i].id+'">'+mydata.data[i].name+'</option>';
	            }
	            pObj.html('&nbsp;&nbsp;<select name="subcate"><option value="0">请选择</option>'+html+'</select>');


                //子类更改触发的事件
	            $(':input[name="subcate"]').change(function(){
	                var subId=$(this).attr('value');
	                $.ajax({
		                url:'?m=special&a=getPhoto&id='+subId,
		                type:'GET',
		                success:function(feed){
		                    var html='';
		                    eval('data='+feed);
		                    for(var i=0;i<data.photo.length;i++){
			                    html+='<input type="checkbox" name="photo[]" value="'+data.photo[i].id+'" />'+data.photo[i].photo_name+'<img width="45" height="45" src="'+data.photo[i].photo_small+'" />&nbsp;&nbsp;';
		                    }
                            $('#photos').html(html);
		                }
		            });
	            });


	            
	        }
        
	   });
	});






	
});

</script>

<!--script type='text/javascript' src='./template/js/jquery1.8.js'></script-->
<script type='text/javascript' src='./template/js/ajaxfileupload.js'></script>
<form action='?m=special&a=doAdd' method='post'>
<table border='0' width='100%' style='border:1px solid #ccc;' cellspacing='0' cellpadding='0'>
  <tr><td >专题名称：</td><td><input type="text" value="" name='name' size='20' /></td></tr>
  <tr><td colspan='2'>&nbsp;</td></tr>
  <tr><td>小图：</td><td><input type='file' name='spfile' id='spfile' />&nbsp;&nbsp;<input type='button' value='上传' onclick='upload();'></td></tr>
  <tr><td>排序：</td><td><input type='text' name='orderby' size='20' /></td></tr>
  <tr><td>设置为广告：</td><td><input type='checkbox' name='poster' value='1' /></td></tr>
  <tr><td>显示分类：</td><td><input type='checkbox' name='showCate' value='1' /></td></tr>                    
  <tr><td>push时间设置：</td><td><input type='text' name='pushTime' size='20'  readonly="readonly" onclick='$.calendar();' /></td></tr>
  <tr><td>添加图片：</td>
      <td><select name='cate'>
            <option value='0'>请选择分类</option>
            {loop $cate $ck $cv}
            <option value='{$ck}'>{$cv}</option>
            {/loop}
          </select>
      <span id="subcate"></span>
     </td>
 </tr>
 <tr><td colspan='2' id='photos' ></td></tr>
  <tr><td colspan='2'><input type='submit' value='完成' />&nbsp;&nbsp;&nbsp;&nbsp;<input type='reset' value='取消' /></td></tr>
</table>
<input type='hidden' name='img' value='' />
</form>
{subtemplate template/common/com_footer.html}